
<form action="index.php" id="form" method="post">
    <input type="hidden" name="page" value="user"/>
    <input type="hidden" name="action" value="save"/>
    <?php if(isset($user)) echo "<input type='hidden' name='userId' value='{$user->id}'/>";?>
    <table style="margin: 50px;" cellspacing="10px">
        <tr>
            <td>
                First name
            </td>
            <td>
                <input type="text" name="firstName" id="firstName" class="validate[required,length[0,50]]" value="<?php if(isset($user)) echo $user->firstName; ?>">
            </td>
        </tr>
        <tr>
            <td>
                Last name
            </td>
            <td>
                <input type="text" name="lastName" id="lastName" class="validate[required,length[0,50]]" value="<?php if(isset($user)) echo $user->lastName; ?>">
            </td>
        </tr>
        <tr>
            <td>
                Role
            </td>
            <td>
                <select name="userRole" id="userRole">
                    <?php foreach($userRoles as $role){
                    ?>
                    <option value="<?php echo $role->id?>"><?php echo $role->name?></option>
                    <?php }?>
                </select>
            </td>
        </tr>
        <tr>
            <td>
                E-Mail
            </td>
            <td>
                <input type="text" name="email" id="email" class="validate[required,custom[email]]" value="<?php if(isset($user)) echo $user->email; ?>">
            </td>
        </tr>
        <tr>
            <td>
                Password
            </td>
            <td>
                <input type="text" name="password" id="password" class="validate[required,length[0,50]]" value="<?php if(isset($user)) echo $user->password; ?>">
            </td>
        </tr>
        <tr>
            <td>
                Mobile
            </td>
            <td>
                <input type="text" name="mobile" id="mobile" class="validate[required,custom[phone]]" value="<?php if(isset($user)) echo $user->mobile; ?>">
            </td>
        </tr>
        <tr>
            <td></td><td></td>
            <td>
                <input type="submit" name="save" value="save" id="mobile">
            </td>
        </tr>
    </table>
</form>